<?php
class UserpicViewModel extends Model{
    protected $viewModel = true;
    protected $viewFields = array(

        'User'=>array('id'=>'uid','bname','bsex','bage','kname','note','totalVote'),
        'Userpic'=>array('id','picName','userID','picUrl','picUrl2','picNote','picVoteNum', '_on'=>'User.id = Userpic.userID'),
    );

    function updateVote($uid){
        $num = D("Userpic")->sum("picVoteNum","userID=$uid");
        D("User")->setField("totalVote","$num","id=$uid");
    }

    
    
} 
?>